unit UPharmacyStockTransfer;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvPanel, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue, cxGroupBox, DBAdvGlowNavigator,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, UDMPharmacy,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, Vcl.StdCtrls, Vcl.Mask, Vcl.DBCtrls, cxDBEdit, cxCalendar, UDMSettings;

type
  TFPharmacyStockTransfer = class(TForm)
    AdvPanel1: TAdvPanel;
    AdvPanelStyler1: TAdvPanelStyler;
    cxGroupBox1: TcxGroupBox;
    AdvPanel2: TAdvPanel;
    DBAdvGlowNavigator1: TDBAdvGlowNavigator;
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    Label1: TLabel;
    cxDBLookupComboBox1: TcxDBLookupComboBox;
    Label2: TLabel;
    cxDBLookupComboBox3: TcxDBLookupComboBox;
    Label3: TLabel;
    cxDBTextEdit1: TcxDBTextEdit;
    Label4: TLabel;
    Label5: TLabel;
    cxDBDateEdit1: TcxDBDateEdit;
    cxGrid1DBTableView1pricing_id: TcxGridDBColumn;
    cxGrid1DBTableView1dept_id_from: TcxGridDBColumn;
    cxGrid1DBTableView1dept_id_to: TcxGridDBColumn;
    cxGrid1DBTableView1transfer_date: TcxGridDBColumn;
    cxGrid1DBTableView1qty: TcxGridDBColumn;
    cxGroupBox2: TcxGroupBox;
    Label6: TLabel;
    cxDBTextEdit2: TcxDBTextEdit;
    Label7: TLabel;
    cxDBLookupComboBox4: TcxDBLookupComboBox;
    Label8: TLabel;
    cxDBTextEdit3: TcxDBTextEdit;
    Label9: TLabel;
    cxDBDateEdit2: TcxDBDateEdit;
    Label10: TLabel;
    cxDBTextEdit4: TcxDBTextEdit;
    Label11: TLabel;
    cxDBTextEdit5: TcxDBTextEdit;
    cxDBLookupComboBox2: TcxDBLookupComboBox;
    procedure DBAdvGlowNavigator1BtnCancel(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnEdit(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnFirst(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnInsert(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnLast(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnNext(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnPost(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnPrior(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnRefresh(Sender: TObject);
    procedure cxDBLookupComboBox1PropertiesEditValueChanged(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FPharmacyStockTransfer: TFPharmacyStockTransfer;

implementation

{$R *.dfm}

procedure TFPharmacyStockTransfer.cxDBLookupComboBox1PropertiesEditValueChanged(
  Sender: TObject);
begin
  DMPharmacy.his_pharmacy_stock_pharmacy_stock_sub.Locate('pricing_id',Self.cxDBLookupComboBox1.EditValue, []);
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnCancel(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.Cancel;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnEdit(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMPharmacy.his_pharmacy_stock_transfer.Edit;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnFirst(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.First;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnInsert(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMPharmacy.his_pharmacy_stock_transfer.Insert;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnLast(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.Last;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnNext(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.Next;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnPost(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMPharmacy.his_pharmacy_stock_transfer.FieldByName('dept_id_from').Value := Self.cxDBLookupComboBox2.EditValue;
  DMPharmacy.his_pharmacy_stock_transfer.Post;
  DMPharmacy.his_pharmacy_stock_transfer.RefreshRecord;
  Self.AdvPanel1.Enabled := false;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnPrior(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.Prior;
end;

procedure TFPharmacyStockTransfer.DBAdvGlowNavigator1BtnRefresh(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMPharmacy.his_pharmacy_stock_transfer.RefreshRecord;
end;

end.
